<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>

<html xmlns="http://www.w3.org/1999/xhtml">
<%
    if(request.getSession().getAttribute("loginUser")!=null){
        response.sendRedirect(request.getContextPath()+"/home?action=index");
    }
%>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <%@ include file="/common/client/header.jsp" %>
    <script type="text/javascript" src="${ctx}/statics/js/login/login.js"></script>
    <title>易买网</title>
</head>
<body>
<!--Begin Login Begin-->
<div class="log_bg">
    <div class="top">
        <div class="logo"><a href="${ctx}/home?action=index"><img src="${ctx}/statics/images/logo.png" /></a></div>
    </div>
    <div class="login">
        <div class="log_img"><img src="${ctx}/statics/images/l_img.png" width="611" height="425" /></div>
        <div class="log_c">
            <form>
                <table border="0" style="width:370px; font-size:14px; margin-top:30px;" cellspacing="0" cellpadding="0">
                    <tr height="50" valign="top">
                        <td width="55">&nbsp;</td>
                        <td>
                            <span class="fl" style="font-size:24px;">验证码登录</span>
                            <span class="fr">还没有商城账号，<a href="${ctx}/register?action=toRegister" style="color:#ff4e00;">立即注册</a></span>
                            <br>
                        </td>
                    </tr>
                    <tr height="70">
                        <td>手机号码</td>
                        <td><input type="text" name="phone" id="phone" value="" class="l_user" /></td>
                    </tr>
                    <tr height="70">
                        <td>验证码</td>
                        <td><input type="password" name="yzm" id="yzm" value="" class="l_pwd" /><input type="button" id="btn" onclick="settime(this)" value="点击获取验证码"></td>

                    </tr>
                    <tr height="60">
                        <td>&nbsp;</td>
                        <td><input type="button" value="登录" class="log_btn" onclick="loginYzm();" /></td>
                    </tr>
                </table>
            </form>
        </div>
    </div>
</div>
<!--End Login End-->
<!--Begin Footer Begin-->
<div class="btmbg">
    <div class="btm">
        备案/许可证编号：蜀ICP备12009302号-1-www.dingguagua.com   Copyright © 2015-2018 尤洪商城网 All Rights Reserved. 复制必究 , Technical Support: Dgg Group <br />
        <img src="${ctx}/statics/images/b_1.gif" width="98" height="33" /><img src="${ctx}/statics/images/b_2.gif" width="98" height="33" /><img src="${ctx}/statics/images/b_3.gif" width="98" height="33" /><img src="${ctx}/statics/images/b_4.gif" width="98" height="33" /><img src="${ctx}/statics/images/b_5.gif" width="98" height="33" /><img src="${ctx}/statics/images/b_6.gif" width="98" height="33" />
    </div>
</div>
<!--End Footer End -->
<script>
    var countdown=60;


    function settime(obj) {

        var phone=$("#phone").val();

        if(phone==null || phone==""){
            showMessage("电话号码不能为空.");
            return;
        }

        $.ajax({
            url:contextPath+"/login",
            method:"post",
            data:{phone:phone,action:"loginYzmType"},
            success:function(jsonStr){
                var result=eval("("+jsonStr+")");
                if(result.status==1){
                    settime2(obj);
                }else{
                    showMessage(result.message);
                }
            }
        })


    }

    function loginYzm() {

        var yzm=$("#yzm").val();
        var phone=$("#phone").val();

        if(yzm==null || yzm==""){
            showMessage("验证码不能为空.");
            return;
        }

        $.ajax({
            url:contextPath+"/login",
            method:"post",
            data:{yzm:yzm,phone:phone,action:"loginYzm"},
            success:function(jsonStr){
                var result=eval("("+jsonStr+")");
                if(result.status==1){
                    window.location.href=contextPath+"/home?action=index";
                }else{
                    showMessage(result.message)
                }
            }
        })

    }

    function settime2(obj) {


        if (countdown == 0) {
            obj.removeAttribute("disabled");
            obj.value="点击获取验证码";
            countdown = 60;
            return;
        } else {
            obj.setAttribute("disabled", true);
            obj.value="重新发送(" + countdown + ")";
            countdown--;
        }
        setTimeout(function() {
                settime2(obj) }
            ,1000)
    }
</script>
</body>
<!--[if IE 6]>
<script src="//letskillie6.googlecode.com/svn/trunk/2/zh_CN.js"></script>
<![endif]-->
</html>
